<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>刷单列表 - 【妖精猫】后台</title>
<meta name="author" content="frankie" />

<link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
<script type="text/javascript" src="${base}/resources/admin/js/list.js"></script>
<script type="text/javascript">
$().ready(function() {

	var $listForm = $("#listForm");
		
	var $storeSelect = $("#storeSelect");
	var $storeOption = $("#storeOption a");
	var $storeId = $("#storeId");
	
	var $statusSelect = $("#statusSelect");
	var $statusOption = $("#statusOption a");
	var $orderStatus = $("#orderStatus");
	
	var $operatorCheck = $("#operator");
	var $attentionCheck = $("#attention");
	
	// 店铺id
	$storeSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击店铺id
	$storeOption.click( function() {
		var $this = $(this);
		$storeId.val($this.attr("val"));
		$listForm.submit();
		return false;
	});
	
	// 订单状态
	$statusSelect.mouseover( function() {
		var $this = $(this);
		var offset = $this.offset();
		var $menuWrap = $this.closest("div.menuWrap");
		var $popupMenu = $menuWrap.children("div.popupMenu");
		$popupMenu.css({left: offset.left, top: offset.top + $this.height() + 2}).show();
		$menuWrap.mouseleave(function() {
			$popupMenu.hide();
		});
	});
	
	// 点击订单状态
	$statusOption.click( function() {
		var $this = $(this);
		$orderStatus.val($this.attr("val"));
		$listForm.submit();
		return false;
	});
	
	$operatorCheck.change(function() {
		$listForm.submit();
		return false;
	}); 
	
	$attentionCheck.change(function() {
		$listForm.submit();
		return false;
	}); 

	[@flash_message /]

});
</script>
</head>
<body>
	<div class="path">
		<a href="${base}/admin/common/index.jhtml">${message("admin.path.index")}</a> &raquo; 刷单条目列表 <span>(${message("admin.page.total", page.total)})</span>
	</div>
	<form id="listForm" action="list.jhtml" method="get">
		<div class="bar">
			<a href="add.jhtml" class="iconButton">
				<span class="addIcon">&nbsp;</span>${message("admin.common.add")}
			</a>
			<div class="buttonWrap">
				[#if editPermission == "ok"]
				<a href="javascript:;" id="deleteButton" class="iconButton disabled">
					<span class="deleteIcon">&nbsp;</span>${message("admin.common.delete")}
				</a>
				[/#if]
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
						${message("admin.page.pageSize")}<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="pageSizeOption">
							<li>
								<a href="javascript:;"[#if page.pageSize == 10] class="current"[/#if] val="10">10</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 20] class="current"[/#if] val="20">20</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 50] class="current"[/#if] val="50">50</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageSize == 100] class="current"[/#if] val="100">100</a>
							</li>
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.storeId}" id="storeId" name="storeId">
				<div class="menuWrap">
					<a href="javascript:;" id="storeSelect" class="button">
						[#if page.pageable.storeId == '']店铺名称[#elseif page.pageable.storeId == 1]贾斯特曼[#elseif page.pageable.storeId == 2]真丶性情[#elseif page.pageable.storeId == 3]真性情商城[#elseif page.pageable.storeId == 4]胡佩刚[/#if]
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="storeOption">
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == ''] class="current"[/#if] val="">全部</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '1'] class="current"[/#if] val="1">贾斯特曼</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '2'] class="current"[/#if] val="2">真丶性情</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '3'] class="current"[/#if] val="3">真性情商城</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.storeId == '4'] class="current"[/#if] val="4">胡佩刚</a>
							</li>
						</ul>
					</div>
				</div>
				
				<input type="hidden" value="${page.pageable.orderStatus}" id="orderStatus" name="orderStatus">
				<div class="menuWrap">
					<a href="javascript:;" id="statusSelect" class="button">
						[#if page.pageable.orderStatus == '']订单状态[#elseif page.pageable.orderStatus == 0]初始化[#elseif page.pageable.orderStatus == 1]已处理[#elseif page.pageable.orderStatus == 2]已失败[/#if]
						<span class="arrow">&nbsp;</span>
					</a>
					<div class="popupMenu">
						<ul id="statusOption">
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == ''] class="current"[/#if] val="">全部</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '1'] class="current"[/#if] val="0">初始化</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '2'] class="current"[/#if] val="1">已处理</a>
							</li>
							<li>
								<a href="javascript:;"[#if page.pageable.orderStatus == '2'] class="current"[/#if] val="2">已失败</a>
							</li>
						</ul>
					</div>
				</div>
				
				<div class="menuWrap">
					<a href="javascript:;" id="statusSelect" class="button">
						<span>仅显示个人订单</span>
						<input type="checkbox" name="operator" id="operator" value="${operator}" [#if (page.pageable.operator)??]checked="checked"[/#if]>
					</a>
				</div>
				
				<div class="menuWrap">
					<a href="javascript:;" id="statusSelect" class="button">
						<span>仅显示关注订单</span>
						<input type="checkbox" name="attention" id="attention" value="1" [#if page.pageable.attention]checked="checked"[/#if]>
					</a>
				</div>
				
			</div>
			
			<div class="menuWrap">
				<div class="search">
					<span id="searchPropertySelect" class="arrow">&nbsp;</span>
					<input type="text" id="searchValue" name="searchValue" value="${page.searchValue}" maxlength="200" />
					<button type="submit">&nbsp;</button>
				</div>
				<div class="popupMenu">
					<ul id="searchPropertyOption">
						<li>
							<a href="javascript:;"[#if page.searchProperty == "name"] class="current"[/#if] val="name">用户名</a>
						</li>
						<li>
							<a href="javascript:;"[#if page.searchProperty == "qq"] class="current"[/#if] val="qq">QQ</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				[#if editPermission == "ok"]
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
				[/#if]
				<th>
					<a href="javascript:;" class="sort" name="name">用户名</a>
				</th>
				<th>
					<span>关键字</span>
				</th>
				<th>
					<span>金额</span>
				</th>
				<th>
					<span>佣金</span>
				</th>
				<th>
					<span>店铺</span>
				</th>
				<th>
					<span>平台</span>
				</th>
				<th>
					<span>昵称</span>
				</th>
				<th>
					<span>QQ</span>
				</th>
				<th>
					<span>状态</span>
				</th>
				<th>
					<span>操作人</span>
				</th>
				<th>
					<a href="javascript:;" class="sort" name="createDate">操作时间</a>
				</th>
				[#if editPermission == "ok"]
				<th>
					<span>操作</span>
				</th>
				[/#if]
			</tr>
			[#list page.content as item]
				<tr>
					[#if editPermission == "ok"]
					<td>
						<input type="checkbox" name="ids" value="${item.id}" />
					</td>
					[/#if]
					<td>
						<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid=${item.name}&siteid=cntaobao&status=1&charset=utf-8">
							<img border="0" src="http://amos.alicdn.com/online.aw?v=2&uid=${item.name}&site=cntaobao&s=1&charset=utf-8" alt="点这里给我发消息" />
							&nbsp;<span>${item.name}</span>
						</a>
					</td>	
					<td>
						<span>${item.keyword}</span>
					</td>
					<td>
						<span>${currency(item.sum, true)}</span>
					</td>
					<td>
						<span>${currency(item.commission, true)}</span>
					</td>
					<td>
						<span>[#if item.storeId == 1]贾斯特曼[#elseif item.storeId == 2]真丶性情[#elseif item.storeId == 3]真性情商城[#elseif item.storeId == 4]胡佩刚[/#if]</span>
					</td>
					<td>
						<span>${item.platform}</span>
					</td>
					<td>
						<span>${item.fromNick}</span>
					</td>
					<td>
						<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=${item.qq}&site=qq&menu=yes">
							<img border="0" src="http://wpa.qq.com/pa?p=2:${item.qq}:51" alt="点击这里给我发消息" title="点击这里给我发消息"/>
							&nbsp;<span>${item.qq}</span>
						</a>
					</td>
					<td>
						[#if item.status == 0]<span style="color:green;">初始化[#elseif item.status == 1]<span style="color:blue;">已处理[#elseif item.status == 2]<span style="color:red;" title="${item.memo}">失败[/#if]</span>
					</td>
					<td>
						<span>${item.operator}</span>
					</td>
					<td>
						<span title="${item.createDate?string("yyyy-MM-dd")}">${item.createDate}</span>
					</td>
					[#if editPermission == "ok"]
					<td>
						<a href="edit.jhtml?id=${item.id}">[编辑]</a>
					</td>
					[/#if]
				</tr>
			[/#list]
		</table>
		[@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
			[#include "/admin/include/pagination.ftl"]
		[/@pagination]
	</form>
</body>
</html>